//
//  HomeCell.m
//  ShowMe
//
//  Created by 123 on 2018/8/28.
//  Copyright © 2018年 nkl. All rights reserved.
//

#import "HomeCell.h"

@interface HomeCell()
@property(nonatomic,strong) UIImageView * cellImageView;
@property(nonatomic,strong) UILabel * cellLabel;

@end

@implementation HomeCell

-(UIImageView *)cellImageView{
    if (!_cellImageView) {
        _cellImageView = [[UIImageView alloc] init];
        _cellImageView.backgroundColor = [UIColor whiteColor];
    }
    return _cellImageView;
}

-(UILabel *)cellLabel{
    if (!_cellLabel) {
        _cellLabel = [[UILabel alloc] init];
        _cellLabel.textColor = UIColor.whiteColor;
    }
    return _cellLabel;
}
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = UIColor.clearColor;
        [self setUpUI];
    }
    return self;
}



-(void)setDataForCellWithModel:(ClassModel * )model{
    self.cellLabel.text = model.ClassType;
    NSURL * url = [NSURL URLWithString:model.imgUrl];
    [self.cellImageView sd_setImageWithURL:url];
}

-(void)setUpUI{
    [self addSubview:self.cellImageView];
    [self addSubview:self.cellLabel];
}

-(void)layoutSubviews{
    [super layoutSubviews];
    [self.cellImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.bottom.right.equalTo(self);
    }];
    [self.cellLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self).offset(__KNewSize(12));
        make.left.equalTo(self).offset(__KNewSize(21));
    }];
}

@end
